package com.leff.cards.web.requests;

import com.leff.cards.util.Dictionary;
import com.leff.cards.web.WebRequest;
import com.leff.notifications.NotificationCenter;

public class InviteRequest extends WebRequest {
	
	public static final String INVITE_SUCCESSFUL = "InviteSuccessful";
	
	public InviteRequest(long groupId, long fbid) {
		this(groupId, new long[] { fbid });
	}
	
	public InviteRequest(long groupId, long[] ids) {
		super(WebCommand.INVITE_USER);
		
		mParameters.put(Parameter.GROUP_ID, groupId);
		
		StringBuilder sb = new StringBuilder();
		boolean first = true;
		for(long id : ids) {
			if(!first) {
				sb.append(",");
			}
			sb.append(id);
			first = false;
		}
		mParameters.put(Parameter.FB_ID, sb.toString());
	}

	@Override
	protected void parseResultDictionary(Dictionary dict) {
		NotificationCenter.postNotification(INVITE_SUCCESSFUL, dict);
	}
}
